package logic

import (
	"context"
	"doctor-medicine-system/models/mysql"

	"doctor-medicine-system/doctorrpc/doctorrpc"
	"doctor-medicine-system/doctorrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type DoctorListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDoctorListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DoctorListLogic {
	return &DoctorListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *DoctorListLogic) DoctorList(in *doctorrpc.DoctorListRequest) (*doctorrpc.DoctorListResponse, error) {
	// todo: add your logic here and delete this line
	var medicine mysql.Medicine
	list := medicine.MedicineList(mysql.DB, in.DoctorId)
	return &doctorrpc.DoctorListResponse{
		List: list,
	}, nil
}
